<template>
  <div class="goods">
    <h2>商品管理</h2>
    <!-- 面包屑 -->
    <el-bread></el-bread>
    <!-- 添加按钮 -->
    <el-button @click="getDialog" type="primary" plain>添加</el-button>
    <!-- 表格 -->
    <v-list @edit="edit"></v-list>
    <!-- dialog弹框 -->
    <v-dialog ref="goodsDialog" @cancel="cancel()" :isShow="isShow" :isAdd="isAdd"></v-dialog>
  </div>
</template>
<script>
import vDialog from "./dialog.vue"
import vList from "./list.vue"
export default {
  data() {
    return {
      isShow: false,
      isAdd: true
    };
  },
  components: { vDialog, vList },
  mounted() {
  },
  methods: {
    //添加按钮  显示dialog弹框
    getDialog() {
      //dialog弹框显示
      this.isShow = true
      //打开的是编辑弹框
      this.isAdd = true
    },
    //dialog页面取消  关闭dialig弹框
    cancel() {
      this.isShow = false
    },
    //数据回显
    edit(e) {
      this.isShow = true
      //这是一个编辑dialog弹框
      this.isAdd = false
      //数据回显  传递id
      this.$refs.goodsDialog.lookup(e)
    }
  },
};
</script>
<style scoped></style>